package com.epam.lissina.entity;

import java.util.List;

import com.epam.lissina.collector.Collect;
import com.epam.lissina.separator.TextSeparator;

public class Paragraph implements IParagraph {

	private List<Sentence> sentence;

	public Paragraph(String paragraph) {
		sentence = TextSeparator.parseParagraph(paragraph);
	}

	public List<Sentence> getSentence() {
		return sentence;
	}

	@Override
	public String toString() {
		return "    " + Collect.join(sentence, " ");
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((sentence == null) ? 0 : sentence.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Paragraph other = (Paragraph) obj;
		if (sentence == null) {
			if (other.sentence != null)
				return false;
		} else if (!sentence.equals(other.sentence))
			return false;
		return true;
	}
}
